class Bullet {
  constructor (ctx, hero) {
    this.ctx = ctx
    this.hero = hero
    this.img = new Image()
    this.img.src = 'images/bullet.png'
    this.init = {
      x: this.hero.init.x + this.hero.init.w / 2 - 15.5,
      y: this.hero.init.y - 54,
      w: 31,
      h: 54
    }
    this.status = true
  }
  draw () {
    this.init.y -= 5
    if(this.init.y < 0){
      this.status = false
    }
    this.ctx.drawImage(this.img, this.init.x, this.init.y, this.init.w, this.init.h)
  }
}
export default Bullet